
<?php require_once 'include/head.php';?>
<!--login start-->
    <div class="login">
		<ul>
        	<li class="clearfix">
            	<span class="fl wd20">用户名</span>
                <input class="fl wd70" type="text" id="username" placeholder="请输入您的用户名" onblur="check_username()">
            </li>
            <li class="clearfix">
            	<span class="fl wd20">密码</span>
            	<input class="fl wd70" type="password" id="password" placeholder="请输入您的登录密码" >
            </li>
        </ul>
    </div>
<!--login end-->

<!--login_btn start-->
	<div class="login_btn mt90">
            <input class="disB font15 cfff wd80 mA texC" onclick="login()"type="button" value="登 录" />
    </div>
<!--login_btn end-->
</body>
<script type="text/javascript">
    function login(){
        var username=$("#username").val();
        var password=$("#password").val();
        if(username ==null || username==''){
            $.alert({
                    title: '提示',
                    content:'用户名不能为空',
                    confirm: function(){
                    }
                });
                 return false;
        }
        if(password ==null || password==''){
            $.alert({
                    title: '提示',
                    content:'密码不能为空',
                    confirm: function(){
                    }
                });
                 return false;
        }
        var data={username:username,password:password};
        var bool=false;
        $.ajax({
                url:"/wap/login/login",
                async: false,
                type:"post",
                data: data,
                dataType: 'json',
                success:function(data) {
                       if(data.success!='1'){
                            $.alert({
                                title: '提示',
                                content:data.msg,
                                confirm: function(){
                                }
                            });
                             return false;
                        }else{
                            window.location.href=data.url;
                        }
                }	
            });
           
    }
    function check_username(){
        var username=$("#username").val();
         if(username ==null || username==''){
            $.alert({
                    title: '提示',
                    content:'用户名不能为空',
                    confirm: function(){
                    }
                });
                 return false;
        }
        var data={username:username};
        var bool=false;
        $.ajax({
                url:"/wap/login/check_username",
                async: false,
                type:"post",
                data: data,
                dataType: 'json',
                success:function(data) {
                        bool = data;
                }	
            });
            if(!bool){
                $.alert({
                    title: '提示',
                    content:'用户名不存在',
                    confirm: function(){
                    }
                });
                 return false;
            }
        
    }
</script>
</html>